﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
using Sucdri.Domain.Interface;
using Sucdri.Domain.Model;

namespace Sucdri.Domain.Repository.Test
{
   [TestFixture]
   public class ProjectMainTest
   {
      [Test]
      public void CanCreateDomainObject()
      {
         var obj = new ProjectMain
         {
            RprjName = "TEST",
            RprjNum = "1",
            RprjRoleID = 1,
            RprjPlatformID = 1
         };
         var rep = new ProjectMainRepository();
         rep.Create(obj);
         //Assert.Greater(result,0);
      }

      [Test]
      public void CanCreateDomainObjectInUnitOfWork()
      {
         var obj = new ProjectMain
         {
            RprjName = "TEST",
            RprjNum = "1",
            RprjRoleID = 1,
            RprjPlatformID = 1
         };
         using(IUnitOfWork uow = UnitOfWork.BeginTransaction())
         {
            var rep = new ProjectMainRepository();
            rep.Create(obj);
            uow.Commit();
         }
       
         //Assert.Greater(result,0);
      }

      [Test]
      public void CanCreateMultipulDomainObjectInUnitOfWork()
      {
         var obj1 = new ProjectMain
         {
            RprjName = "TEST1",
            RprjNum = "1",
            RprjRoleID = 1,
            RprjPlatformID = 1
         };
         var obj2 = new ProjectMain
         {
            RprjName = "TEST2",
            RprjNum = "1",
            RprjRoleID = 1,
            RprjPlatformID = 1
         };

         var obj3 = new ProjectMain
         {
            RprjName = "TEST3",
            RprjNum = "1",
            RprjRoleID = 1,
            RprjPlatformID = 1
         };

         using (IUnitOfWork uow = UnitOfWork.BeginTransaction())
         {
            var rep = new ProjectMainRepository();
            rep.Create(obj1);
            rep.Create(obj2);
            rep.Create(obj3);
            uow.Commit();
         }

         //Assert.Greater(result,0);
      }
   }
}
